/**
 * Created by Administrator on 2018/4/16 0016.
 */
import config from '../../../../config/config.js'
// components
import atyButton from '../../../basic/button/index.vue'
// mixins
import Locale from '../../../../mixins/locale.js'
// prefix
const prefixCls = config.prefix + '-picker'

export default {
  mixins: [Locale],
  components: { atyButton },
  props: {
    /**
     * #property
     *
     * @name    showTime
     * @cn      是否时间选择
     * @group   控制
     * @type    boolean
     * @value  false
     * @description  是否时间选择
     */
    showTime: false,
    /**
     * #property
     *
     * @name    isTime
     * @cn      是否是时间组件
     * @group   控制
     * @type    boolean
     * @value  false
     * @description  是否是时间组件，否则就是日期组件
     */
    isTime: false,
    /**
     * #property
     *
     * @name    timeDisabled
     * @cn      是否禁用时间选择
     * @group   控制
     * @type    boolean
     * @value  false
     * @description  是否禁用时间选择
     */
    timeDisabled: false,
    clearable: true
  },
  data () {
    return {
      prefixCls: prefixCls
    }
  },
  computed: {
    timeClasses () {
      return {
        [`${prefixCls}-confirm-time-disabled`]: this.timeDisabled
      }
    }
  },
  methods: {
    handleClear () {
      this.$emit('on-pick-clear')
    },
    handleSuccess () {
      this.$emit('on-pick-success')
    },
    handleToggleTime () {
      if (this.timeDisabled) return
      this.$emit('on-pick-toggle-time')
    }
  }
}
